
#pragma once

#include <vector>
#include <iostream>
#include <boost/asio.hpp>
#include <memory> // 用于 std::unique_ptr

class UdpSender
{
public:
    UdpSender(const std::string &bindIP, const std::string &remoteIP, unsigned short port);
    ~UdpSender();

    bool send(std::vector<uint8_t> buffer);

    bool dispose();

private:
    std::unique_ptr<boost::asio::ip::udp::socket> socket_; // 使用智能指针管理 socket
    boost::asio::ip::udp::endpoint endpoint_;
    boost::asio::io_context *io_context_ = nullptr;
};